<?php

class HttpReader {
    
    function __construct() {
        
    }
    
    public function read() {
        
        if( filesize('php://input') > MAX_FILE_SIZE){
            throw new Exception(ERR_MSG_FILE_3, ERR_CODE_FILE_3);
        }
        $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
        
        if($GLOBALS["HTTP_RAW_POST_DATA"] == ''){
            throw new Exception(ERR_MSG_FILE_2,ERR_CODE_FILE_2);
        }
        
        $stream = $GLOBALS["HTTP_RAW_POST_DATA"];
        return $stream;
    }
}